function e(e) {
  return e && e.__esModule ? e : {
    default: e
  };
}



  var a = e(require("api/api.js")),
    t = (e(require("utils/util.js")), e(require("utils/filter.js")),
      require("config/constants.js"), e(require("devops/raven/raven")));

require("./utils/mtj-wx-sdk.js");
var qcloud = require("./vendor/wafer2-client-sdk/index");
var config = require('./config');

App({
  globalData: {
    userInfo: null,
    userPersonalInfo: {},
    token: "",
    currencyDatum: [],
    isCharged: !1
  },
  onLaunch: function() {
    //zl set loginurl - 2018.9.10
    qcloud.setLoginUrl(config.service.loginUrl);

    var e = this,
      a = this,
      n = wx.getStorageSync("logs") || [];
    n.unshift(Date.now()), wx.setStorageSync("logs", n);
    var r = {
      environment: "production"
    };
    t.default.config("https://aa83721bcf1b440b8703ff1ed0b1220b@sentry.italki.cn/6", r).install(),
      wx.getSetting({
        success: function(a) {
          a.authSetting["scope.userInfo"] && wx.getUserInfo({
            success: function(a) {
              e.globalData.userInfo = a.userInfo, e.userInfoReadyCallback && e.userInfoReadyCallback(a);
            }
          });
        }
      });
    var o = wx.getStorageSync("userPersonalInfo") || {},
      s = wx.getStorageSync("token") || "";
    a.globalData.userPersonalInfo = o, a.globalData.token = s, 0 === Object.keys(a.globalData.userPersonalInfo).length && a.globalData.token && a.login(),
      a.getCurrency();
  },
  login: function() {
    var e = this,
      t = {
        i_token: e.globalData.token
      };
    a.default.loginViaToken({
      method: "POST",
      data: t,
      success: function(a) {
        if (a && a.data.data) {
          var t = a.data.data;
          e.globalData.userPersonalInfo = t, wx.setStorage({
            key: "userPersonalInfo",
            data: t
          });
        }
      }
    });
  },
  getCurrency: function() {
    var e = this;
    a.default.getCurrency({
      success: function(a) {
        if (a && a.data.data) {
          var t = a.data.data;
          e.globalData.currencyDatum = t;
        }
      }
    });
  },
  onError: function(e) {
    t.default.captureException(e, {
      level: "error"
    });
  }
});